<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

    <script>
            var json1={
        "username":"吕布",
        "age":21
    };
    console.log("姓名:"+json1.username+",年龄:"+json1.age);

    //json数组
    var jsonarr=[{"name":"貂蝉","age":18},{"name":"小乔","age":17}];
    console.log("貂蝉"+jsonarr[0].age+"岁了");
    console.log("小乔"+jsonarr[1].age+"岁了");

    //复杂的json对象
    var zhaoyun={
        name:"赵云",
        sex:"男",
        hobby:["玉兰白龙驹","龙胆亮银枪","青釭剑"]
    };
    console.log(zhaoyun.name+"的主武器:"+zhaoyun.hobby[1]);
    </script>
</body>
</html>